//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
// 			VisualNovelToolkit		     /_/_/_/_/_/_/_/_/_/.
// Copyright ©2013 - Sol-tribe.	/_/_/_/_/_/_/_/_/_/.
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
using UnityEngine;
using System.Collections;
using ViNoToolkit;

/// <summary>
/// Vi no text event listener.
/// Update a TextView text.
/// </summary>
public class ViNoTextEventListener : MonoBehaviour{
	public ViNoTextBox m_TextBox;
	public GameObject promptObject;
	public bool hasPromptImageLast;

	void OnEnable(){
		Enabled();
	}

	virtual public void CommitChanges(){}

	virtual public void OnStartMessage(){
		if( m_TextBox.useTextAfterEffect ){
			m_TextBox.DoTextDisplayEffect();
		}

		if( promptObject != null ){
			promptObject.SetActive( false );
		}
	}

	virtual public void ResetFont(){}

	virtual public void OnPropertyChange( Hashtable param ){}

	virtual public void Enabled(){}
	
	virtual public void OnAppend( string text ){}
	
	/// <summary>
	/// Raises the update text event.
	/// </summary>
	/// <param name='theText'>
	/// The text.
	/// </param>
	virtual public void OnUpdateText( string theText ){}
	
	virtual public void OnTextSet( string theText ){}

	virtual public string GetBeginColorTag( Color col ){
		string colStr = ColorUtil.GetHexColorString( col );
		return "<color=" + colStr + ">";
	}
	
	virtual public string GetEndColorTag(){
		return "</color>";
	}
		
	/// <summary>
	/// Raises the displayed text event.
	/// </summary>
	virtual public void OnDisplayedText(){
		// Now , All the Message is Displayed , Activate the PromptObject .
		if( promptObject != null ){
			promptObject.SetActive( true );
		}
	}

}
